<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"
	  xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head>
<meta charset="utf-8" />
<title>云南供应链系统</title>
<script type="text/javascript" src="${ctx}/resources/js/index.js"></script>
<script type="text/javascript" th:inline="javascript">
var path ;
var tabs;
var tmpCount = 0;
var curIndexpage = "index_apply_cont.jsp";//默认处理下需求人员与采购人员界面 需求人员界面
// var curIndexpage = "index_cont.jsp";//默认采购人员界面
var myWorkPage = "myWorkPage.jsp";
//采购领导首页 指向路径
var myLeadHome = "${pageContext.request.contextPath}"+"app/leadBI/leadHome/detail";
var indexPurchaseLeadRole =$("#indexPurchaseLeadRole").val();//采购领导首页
var indexPurchaseNormalRole =$("#indexPurchaseNormalRole").val();//采购首页权限

// indexPurchaseLeadRole ='true';
if(indexPurchaseLeadRole=='true' || indexPurchaseNormalRole =='true' )curIndexpage = "index_cont.jsp";//处理下采购人员界面
$(function(){
	path="${pageContext.request.contextPath}";
	//设置获取登录用户信息
	 $.post(path+"app/sys/loginuser/indexsys/bottom?randomSign="+Math.random(),{},function(msg){	
		var str = msg.split(",");	
		var userName = str[0];
		var orgName = str[1];
		$("#userName").html(userName+" ["+orgName+"]");
		$("#scms_index").attr("href",str[2]);
		if(!isExistence(str[1],'玉溪')){
			$("#dzsc").hide();
		}
	 });
	
	 //设置时间显示
	 //setInterval("document.getElementById('curtime').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
	
	//鼠标移上显示下拉 	
	$("#map").mouseover(function(){	
    	$("#menu-down").css({"display":"block"});
    });	
  	
  	//二级菜单默认隐藏
	$("#menu-down").mouseleave(function(){	
		$(this).hide();
	});
	
	//二级菜单初始色
	$("#menu-down dt").click(function(){
		//二级菜单选中变色  	
		$("#menu-down dt").css({"background-color":"#fff","color":"#000",})
		$(this).css({"background-color": "#15C6EC","color":"#fff",}); 	
		$(this).nextUntil("dt").slideToggle();		
	});
	
	//如果展现转换 领导首页 则 需要转换下指向
    if(indexPurchaseLeadRole=='true'   ){
        curIndexpage=myLeadHome;
        // addMainTab('领导首页',myLeadHome,'1',null);
    }
	//设置首页
	tabs = jQuery('#tabs').cleverTabs({});
	jQuery(window).bind('resize', function() {});
	tabs.add({
		url : curIndexpage,
		label : '首页',
		id : '0',
		lock : true
	});
	
	jQuery('input[type="button"]').button();
	tabs.onLoad();
	
	//添加我的工作台页面
	addMainTab('我的工作台',myWorkPage,'1',null);
	//添加 领导首页 具有采购领导角色 才能看见领导首页  并且锁定界面
    /*if(indexPurchaseLeadRole=='true'   ){
		addMainTab('领导首页',myLeadHome,'1',null);
	}*/
	tabs.getTabByUrl(myWorkPage).setLock(true);
    // 如果是 具有采购领导角色 才能看见领导首页  并且锁定界面  并且登录时 展现 领到首页
    /*if(indexPurchaseLeadRole=='true'   ){
		tabs.getTabByUrl(myLeadHome).setLock(true);
		tabs.getTabByUrl(myLeadHome).activate();
    }else{//其他情况  默认展现 普通首页*/
		tabs.getTabByUrl(curIndexpage).activate();

	// }
	//加载导航菜单
	$.getJSON("${ctx}/app/sys/loginuser/indexsys/showmenu",{},function(msg){	
		
		//准备导航地图数据
		addMenuMap(msg);
	});
	
	setTabHeight(-10);
    popNotice();//加载弹窗公告信息
    
    getBuyCarCounts();
    
})

function getBuyCarCounts(){
	 //设置购物车数量
	$.getJSON("${ctx}/app/basedata/buycarnew/getBuyCarCounts?randomSign="+$("#randomSign").val(),{},function(msg){	
		$("#buyCarCounts").html(msg);
	});
}

function setTabHeight(obj){
	var currentTab = tabs.getCurrentTab();
	$("#cleverTabPanelItem-"+currentTab.id).height($(window).height()+obj)
}
//刷新（编辑页面） 
function addMainTab(moduleName, moduleUrl, id, closeUrl) {
	if(moduleName.length > 3 && id != '1'){
		moduleName=moduleName.substr(0,3)+"...";
	}
	var currentTab = closeUrl === undefined ? tabs.getCurrentTab() : tabs.getTabByUrl(closeUrl);
	if($('#menu_right_border_none li').length <=10){ // 获取当前打开窗口总数量
		tabs.add({
			url : moduleUrl,
			label : moduleName,
			callback : function() {
				if (currentTab.url != curIndexpage){
					//不刷新 
					currentTab.refresh();
				}
				currentTab.activate();
				currentTab.refresh();
				tabs.resizePanelContainer();
			}
		});
	}else{
		top.$.jBox.info("您打开的太多了，请关闭不用的窗口！","提示");
		return false; 
	}
	tabs.onLoad();
	tabs.getTabByUrl(curIndexpage).setLock(true);
}

//查看窗口 不刷新 
function viewTab(moduleName, moduleUrl, id, closeUrl) {
	if(moduleName.length > 3 && id != '1'){
		moduleName=moduleName.substr(0,3)+"...";
	}
	var currentTab = closeUrl === undefined ? tabs.getCurrentTab() : tabs.getTabByUrl(closeUrl);
	if($('#menu_right_border_none li').length <=10){ // 获取当前打开窗口总数量
		tabs.add({
			url : moduleUrl,
			label : moduleName,
			callback : function() {
				currentTab.activate();
				tabs.resizePanelContainer();
			}
		});
	}else{
		top.$.jBox.info("您打开的太多了，请关闭不用的窗口！","提示");
		return false; 
	}
	tabs.onLoad();
	tabs.getTabByUrl(curIndexpage).setLock(true);
}

function showBuycarList() {
	addTab('我的购物车','/app/basedata/buycarnew/findBuyCarList?randomSign='+$("#randomSign").val(),'');
}

</script>
<style>
/* 网站地图样式变化 */
#home{ width:80px; background: url(../resources/images/index/icon-r-list.png) no-repeat 6px 15px #65d9ff; text-indent:15px;}
#home:hover{background: url(../resources/images/index/icon-r-list2.png) no-repeat 6px 15px #57b6ec; }
.wzd{
	margin-top:-20px;
	width:110px;
	margin-right:-2.5px;
}
</style>
</head>
	<body id="main_body" bgcolor="#fff" style="position: relative;">
		<div class="header">
			<img src="${ctx}/resources/images/index/logo.png" class="img1" />
			<p>
					<a href="javascript:logout();" class="bg-red"><img src="${ctx}/resources/images/index/icon-quit.png" />退出</a>
					<a class="bg-yellow"  onclick="showBuycarList()" > <img src="${ctx}/resources/images/index/icon-user.png" />我的购物车
						<span class="buycarcounts" id="buyCarCounts">${buyCarCounts}</span>
					</a>
					<a id="dzsc" class="bg-green"  onclick="addTab('电子商城','/app/basedata/buycarnew/initManPageNormal?isFrame=1','-1')" > <img src="${ctx}/resources/images/index/shop.png" />电子商城</a>
					<a href="" target="_blank" id="scms_index" class="bg-blue1"><img src="${ctx}/resources/images/index/icon-set.png" />旧版入口</a>
					<a class="bg-purp"><img src="${ctx}/resources/images/index/icon-help.png" />帮助</a>	
					<a class="bg-blue active" id="map"><img src="${ctx}/resources/images/index/icon-map.png" />网站地图</a>
					<a style="color:#333"><span class="mr10"><span id="userName" ></span><span>您好！</span></span>	</a>
			</p>

			<!-- 网站导航 -->
			<div id="menu-down"></div>
			
			
		</div>
		
		<!-- 内容frame -->
		<div id="tabs" style="height: 96%" class="nav">
		 	<!-- 标签页 -->
			<div class="tabs_content_bg">
				<div class="tabs_contents">
					<div class="show_ul">
						<ul id="menu_right_border_none">
						<!-- 	<li id="map" class="ui-state-default ui-corner-top ui-state-active">
								<a id="home">网站地图</a>
								<span class="ui-icon ui-icon-locked"></span>
							</li> -->
						</ul>
					</div>
				</div>
			</div>
			<div style="clear: both"></div>
		</div>
		
		
		<!-- 底部信息 -->
		<div class="footer"><span class="mr10"><b>版权所有：</b>中国移动通信集团云南有限公司</span></div>
</body>
</html>
